package cn.geminis.manage.core.entity;

import lombok.Getter;
import lombok.Setter;

import java.time.LocalDateTime;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.PrePersist;
import javax.persistence.PreUpdate;

/**
 * @author Allen
 */
@Entity
@Getter
@Setter
public class Config {

    @Id
    @Column(length = 32)
    private String id;
    @Column(length = 1024)
    private String value;
    @Column(nullable = false)
    private LocalDateTime lastChange;

    @PrePersist
    @PreUpdate
    void updateTime() {
        this.lastChange = LocalDateTime.now();
    }
}
